package beans.factorys.support;

import beans.BeanDefinition;
import beans.factorys.BeanFactory;
import beans.factorys.PropertyValue;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ZhaiGuaili on 2018/7/3.
 */
public class GenericBeanDefinition implements BeanDefinition {
   private String id;
   private String beanClassName;

   private final List<PropertyValue> pvs = new ArrayList<PropertyValue>(32);

    @Override
    public List<PropertyValue> getPropertyValues() {
        return pvs;
    }

    boolean isSingleton = true;
   boolean isPrototype = false;
   String scope = SCOPE_DEFAULT;


    public GenericBeanDefinition() {
        super();
    }


    @Override
    public boolean isSingleton() {
        return this.isSingleton;
    }

    @Override
    public boolean isPrototype() {
        return this.isPrototype;
    }

    @Override
    public void setScope(String scope) {
        this.scope = scope;
        this.isSingleton = SCOPE_SINGLETON.equals(scope) || SCOPE_DEFAULT.equals(scope);
        this.isPrototype = SCOPE_PROTOTYPE.equals(scope);
    }

    @Override
    public String getScope() {
        return this.scope;
    }

    @Override
    public String getBeanClassName() {
        return this.beanClassName;
    }

    public GenericBeanDefinition(String id,String beanclassName){
        this.id = id;
        this.beanClassName = beanclassName;
    }
}
